from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from options import options

url=r'http://192.168.126.131/upload/'
driver=webdriver.Chrome(options=options)
driver.get(url)
driver.maximize_window()
sleep(1)



# 登录
driver.find_element(By.ID,'ls_username').clear()
sleep(2)
driver.find_element(By.ID,'ls_username').send_keys('admin')
driver.find_element(By.ID,'ls_password').clear()
sleep(2)
driver.find_element(By.ID,'ls_password').send_keys('123456')
sleep(3)
driver.find_element(By.XPATH,'//*[@id="lsform"]/div/div/table/tbody/tr[2]/td[3]/button/em').click()
sleep(3)

#进入默认板块
driver.find_element(By.LINK_TEXT,'默认版块').click()
sleep(3)
#查看帖子
driver.find_element(By.XPATH,'//*[@id="normalthread_38"]/tr/th/a[2]').click()
sleep(2)
driver.find_element(By.XPATH,'//*[@id="post_reply"]').click()
sleep(2)
#输入回复内容
driver.find_element(By.ID,'postmessage').send_keys('这是一条顶天立地的回复')
sleep(2)
#点击回复按钮
driver.find_element(By.XPATH,'//*[@id="postsubmit"]').click()
sleep(2)

# 退出
driver.find_element(By.LINK_TEXT, '退出').click()
sleep(3)
